<template>
  <div class="nav">
    <div class="head">
      <ul>
        <li class="index" @click="go('/index')"><a href="javascript:void(0);">首页</a></li>
        <li class="user"><router-link to="/user">用户管理</router-link> </li>
        <li @click="sendMsg" class="register"><router-link to="/register">注册</router-link></li>
        <li> <a>{{ message }}</a></li>
        <li><slot></slot></li>
      </ul>
    </div>
  </div>
</template>

<script>

class Healper {

}

new Healper();

export default {
  name: 'HelloWorld',
  created (){
    //模块被读取(初始化)时调用
  },
  data () {
    return {
    }
  },
  props:['message'],
  methods:{
    go: function(path){
      // debugger
      this.$router.push({path:path});
    },
    sendMsg: function(){
      this.$emit('call-back','haha')
    }
  }
}
</script>

<style scoped>
h1, h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
div.nav {
    background: #F0F0F0;
    text-align: center;
    height: 10%;
}
.head {
  width: 100%;
  height: 5%;
  font-size: 18px;
  padding: 10px 0px;
}
</style>
